Skip to content

fix(predict): prevent buy/sell sheet from being cropped in HomepageDiscoveryTabs cp-7.78.0#30219

Open
vinnyhoward wants to merge 3 commits into
mainfrom
fix-tmcu-752-predict-sheet-homepage-discovery-tabs
Open

fix(predict): prevent buy/sell sheet from being cropped in HomepageDiscoveryTabs cp-7.78.0#30219
vinnyhoward wants to merge 3 commits into
mainfrom
fix-tmcu-752-predict-sheet-homepage-discovery-tabs

Conversation

@vinnyhoward
Copy link
Copy Markdown
Contributor

@vinnyhoward vinnyhoward commented May 14, 2026

Description

When PredictFeed is rendered inside HomepageDiscoveryTabs (behind the coreMCU589AbtestHubPageDiscoveryTabs A/B test), the PredictPreviewSheetProvider bottom sheet is cropped by the tab layout and unusable.

Changes:

  • Added disableBottomSheet prop to PredictPreviewSheetProvider — when true, openBuySheet/openSellSheet navigate to the full-screen bet slip instead of opening the sheet
  • Fixed isPredictSheetProviderMounted to return false in navigate mode, preventing silent order failures (toast was suppressed but sheet never reopened)
  • Added beforeRemove listener to PredictBuyPreview for swipe/hardware-back dismiss tracking in screen mode — previously only back-button dismissals were tracked on the non-AnyToken path

Changelog

CHANGELOG entry:null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-752

Manual testing steps

Feature: Predict buy sheet in HomepageDiscoveryTabs

  Scenario: user opens a prediction from the Predictions tab
    Given the coreMCU589AbtestHubPageDiscoveryTabs flag is set to treatment
    And the user is on the Predictions tab

    When user taps a prediction outcome
    Then the full-screen buy preview opens instead of a bottom sheet

  Scenario: order fails in the background with disableBottomSheet enabled
    Given the user opened and dismissed the buy preview
    When the order fails in the background
    Then a failure toast is shown

Screenshots/Recordings

fixed.mov

Before

broken.mov

After

fixed.mov

Pre-merge author checklist

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Changes Predict bet slip presentation and navigation (sheet vs full-screen) plus dismissal/toast tracking logic, which could affect order-failure UX and analytics in core Predict flows.

Overview
Prevents the Predict buy/sell bottom sheet from being unusable inside HomepageDiscoveryTabs by adding a disableBottomSheet mode to PredictPreviewSheetProvider that always navigates to the full-screen buy/sell previews.

Updates isPredictSheetProviderMounted() to only report mounted when the provider is actually in sheet mode (avoiding suppression of legacy failure toasts when navigating instead), and adjusts navigation calls to use nested Routes.PREDICT.ROOT + screen params.

Adds screen-mode betslip dismissal analytics by registering a beforeRemove listener in PredictBuyPreview to classify swipe vs back-button dismissals, with accompanying test coverage and wiring HomepageDiscoveryTabs to pass disableBottomSheet for the Predictions tab.

Reviewed by Cursor Bugbot for commit 3ee59d2. Bugbot is set up for automated code reviews on this repo. Configure here.

@vinnyhoward vinnyhoward requested review from a team as code owners May 14, 2026 22:45
@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

*/
const clearErrorTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
const dismissedWithErrorRef = useRef(false);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Navigate via ROOT so the screen resolves correctly

Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 4585d39. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokePredictions, SmokeWalletPlatform, SmokeConfirmations
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes are focused on the Predictions (Polymarket) feature with three key modifications:

  1. PredictPreviewSheetContext.tsx: Added disableBottomSheet prop that changes navigation routing from direct modal navigation (Routes.PREDICT.MODALS.BUY_PREVIEW) to nested navigation (Routes.PREDICT.ROOT → screen: BUY_PREVIEW). Also updated isPredictSheetProviderMounted() to return false when in non-sheet mode. This is a behavioral change in how the buy/sell preview flows are navigated to.

  2. PredictBuyPreview.tsx: Refactored dismiss tracking analytics - moved swipe/hardware-back dismissal tracking to a beforeRemove navigation listener for screen mode, while sheet mode retains its own tracking. Also resets predictBuyPreviewDismissedViaBackRef on mount to prevent state bleed between sessions.

  3. HomepageDiscoveryTabs.tsx: Passes disableBottomSheet to PredictPreviewSheetProvider in the Predictions tab within the Hub Page Discovery Tabs A/B test layout. This means when Predict is rendered inside the tab layout, it navigates to full-screen instead of opening a bottom sheet.

Tag selection rationale:

  • SmokePredictions: Directly affected - the buy/sell preview navigation flow, dismiss tracking, and sheet provider behavior are all changed. E2E tests need to verify the full position lifecycle still works correctly with the new navigation routing.
  • SmokeWalletPlatform: Required per SmokePredictions tag description ("also select SmokeWalletPlatform - Trending section"). HomepageDiscoveryTabs.tsx is directly modified, affecting the Trending/Discovery tab where Predictions is embedded.
  • SmokeConfirmations: Required per SmokePredictions tag description ("also select SmokeConfirmations - opening/closing positions are on-chain transactions"). The buy preview flow leads to on-chain transactions.

No other tags are impacted - changes are isolated to Predictions UI/navigation logic with no effects on accounts, networks, swaps, browser, snaps, or other features.

Performance Test Selection:
No performance-impacting changes. The modifications are focused on navigation routing logic (bottom sheet vs full-screen navigation), analytics tracking refactoring, and a prop addition. There are no changes to list rendering, data loading, state management, app startup, or other performance-sensitive areas.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@vinnyhoward vinnyhoward added team-mobile-ux Mobile UX team team-predict Predict team labels May 15, 2026
@vinnyhoward vinnyhoward changed the title fix(predict): prevent buy/sell sheet from being cropped in HomepageDiscoveryTabs fix(predict): prevent buy/sell sheet from being cropped in HomepageDiscoveryTabs cp-7.78.0 May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-M team-mobile-ux Mobile UX team team-predict Predict team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants